<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Compares two variants</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.variant-cat.html">variant_cat</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.variant-date-from-timestamp.html">variant_date_from_timestamp</a></div>
 <div class="up"><a href="ref.com.html">COM 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.variant-cmp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">variant_cmp</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">variant_cmp</span> &mdash; <span class="dc-title">Compares two variants</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.variant-cmp-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>variant_cmp</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$left</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$right</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$lcid</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ]] )</div>

  <p class="para rdfs-comment">
   Compares <em><code class="parameter">left</code></em> with <em><code class="parameter">right</code></em>.
  </p>
  <p class="para">
   This function will only compare scalar values, not arrays or variant records.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.variant-cmp-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">left</code></em></dt>

     <dd>

      <p class="para">
       The left operand.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">right</code></em></dt>

     <dd>

      <p class="para">
       The right operand.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">lcid</code></em></dt>

     <dd>

      <p class="para">
       A valid Locale Identifier to use when comparing strings (this affects
       string collation).
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">flags</code></em></dt>

     <dd>

      <p class="para">
       <em><code class="parameter">flags</code></em> can be one or more of the following values
       OR&#039;d together, and affects string comparisons:
       <table class="doctable table">
        <caption><strong>Variant Comparision Flags</strong></caption>
        
         <thead>
          <tr>
           <th>value</th>
           <th>meaning</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td><strong><code>NORM_IGNORECASE</code></strong></td>
           <td>Compare case insensitively</td>
          </tr>

          <tr>
           <td><strong><code>NORM_IGNORENONSPACE</code></strong></td>
           <td>Ignore nonspacing characters</td>
          </tr>

          <tr>
           <td><strong><code>NORM_IGNORESYMBOLS</code></strong></td>
           <td>Ignore symbols</td>
          </tr>

          <tr>
           <td><strong><code>NORM_IGNOREWIDTH</code></strong></td>
           <td>Ignore string width</td>
          </tr>

          <tr>
           <td><strong><code>NORM_IGNOREKANATYPE</code></strong></td>
           <td>Ignore Kana type</td>
          </tr>

          <tr>
           <td><strong><code>NORM_IGNOREKASHIDA</code></strong></td>
           <td>Ignore Arabic kashida characters</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>

    
   </dl>

  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
<p class="para">
 对于所有变量运算函数，本函数的参数可以是 PHP
 内置的类型（整数，字符串，浮点数，布尔型或者
 <strong><code>NULL</code></strong>），或者是一个 COM，VARIANT 或者 DOTNET 类的实例。PHP
 内置类型将会使用和构造<a href="class.variant.html" class="xref">VARIANT</a>类相同的规则转换成变量。COM 和 DOTNET
 对象的值将会取其默认属性并被当成变量值使用。
</p>
<p class="para">
 变量运算函数是同名函数在 COM
 库中的外包；有关此类函数的更多信息参见 MSDN
 库。PHP 函数命名有少许区别，例如 PHP
 中的 <span class="function"><a href="function.variant-add.html" class="function">variant_add()</a></span> 对应于
 MSDN 文档中的 <em>VarAdd()</em>。
</p>
</p></blockquote>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.variant-cmp-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns one of the following:
   <table class="doctable table">
    <caption><strong>Variant Comparision Results</strong></caption>
    
     <thead>
      <tr>
       <th>value</th>
       <th>meaning</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td><strong><code>VARCMP_LT</code></strong></td>
       <td><em><code class="parameter">left</code></em> is less than
        <em><code class="parameter">right</code></em>
       </td>
      </tr>

      <tr>
       <td><strong><code>VARCMP_EQ</code></strong></td>
       <td><em><code class="parameter">left</code></em> is equal to
        <em><code class="parameter">right</code></em>
       </td>
      </tr>

      <tr>
       <td><strong><code>VARCMP_GT</code></strong></td>
       <td><em><code class="parameter">left</code></em> is greater than
        <em><code class="parameter">right</code></em>
       </td>
      </tr>

      <tr>
       <td><strong><code>VARCMP_NULL</code></strong></td>
       <td>Either <em><code class="parameter">left</code></em>,
        <em><code class="parameter">right</code></em> or both are <strong><code>NULL</code></strong>
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.variant-cat.html">variant_cat</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.variant-date-from-timestamp.html">variant_date_from_timestamp</a></div>
 <div class="up"><a href="ref.com.html">COM 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
